package com.imooc;

import com.imooc.controller.WelcomeController;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import java.util.Arrays;

/**
 * <h1>注册bean定义</h1>
 *
 * @author : dzj
 * @create: 2021-11-04 19:36
 */
@Slf4j
@Configuration
@ComponentScan("com.imooc")
public class Debug0601 {

	public static void main(String[] args) {
		ApplicationContext ctx = new AnnotationConfigApplicationContext(Debug0601.class);
		WelcomeController welcomeController = ctx.getBean(WelcomeController.class);
		welcomeController.handleRequest();
		String[] beanDefinitionNames = ctx.getBeanDefinitionNames();
		Arrays.stream(beanDefinitionNames).forEach(System.out::println);
	}
}
